package com.piece.core.verifycode.factory;

import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 验证码信息封装类
 */
@Data
@NoArgsConstructor
public class ValidateCode implements Serializable {

    private String code;
    private String mathResult;
    private String captchaType;
    private int expire;
    private LocalDateTime expireTime;

    public ValidateCode(String code, int expireIn) {
        this.code = code;
        this.mathResult = code;
        this.expire = expireIn;
        this.expireTime = LocalDateTime.now().plusSeconds(expireIn);
    }

    public ValidateCode(String code, String mathResult, String captchaType, int expireIn) {
        this.code = code;
        this.mathResult = mathResult;
        this.captchaType = captchaType;
        this.expire = expireIn;
        this.expireTime = LocalDateTime.now().plusSeconds(expireIn);
    }

    public ValidateCode(String code, LocalDateTime expireTime) {
        this.code = code;
        this.mathResult = code;
        this.expireTime = expireTime;
    }
}
